import { getSearchList } from '@/api'
const state = {
  SearchList: {}
}
const mutations = {
  // 修改state中categoryList数据的方法
  setSearchList(state, value) {
    state.SearchList = value
  }
}
const actions = {
  // api请求数据并修改state中的数据 接受需要搜索的信息 并根据信息进行api请求 拿到返回值
  async getSearchData({ commit }, params) {
    const res = await getSearchList(params)
    commit('setSearchList', res)
  }
}
const getters = {
  trademarkList(state) {
    return state.SearchList.trademarkList
  },
  attrsList(state) {
    return state.SearchList.attrsList
  },
  goodsList(state) {
    return state.SearchList.goodsList
  }
}
export default {
  // 命名空间打开
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}